import React, { createElement, FC } from 'react';
import { BaseWrapper } from '../base';
import { useFormContainerSelector } from '../../form-container';
import { BaseFieldDate } from './base-field-date';

export interface FieldDateProps {
  name: string;
}

export const FieldDate: FC<FieldDateProps> = (props) => {
  const { columnConfig, onChange, value, ...otherProps } = props;
  const [readonly] = useFormContainerSelector((s) => [s.readonly]);

  return (
    <BaseWrapper {...props}>
      <BaseFieldDate
        dateProps={{
          disabled: readonly || columnConfig?.status === '2',
        }}
        {...props}
      />
    </BaseWrapper>
  );
};
